PHP warning

Undefined global variable $_SESSION

/home3/jilan/public_html/protected/views/ngo/state.php(260)

248                                 onclick="toggleLike(this, <?php echo $row['id']; ?>)">
249                                 <i class="fa fa-thumbs-up" aria-hidden="true" style="font-size:16px"></i>
250                                 <span class="like-count"><?php echo $likeCount; ?></span>
251                                 <span class="like-text"><?php // echo $isLiked ? 'Unlike' : 'Like'; ?></span>
252                             </button>
253                             <div class="liked-users" id="liked-users-<?php echo $row['id']; ?>"></div>
254                                 <button class="button commentButton" onclick="toggleComments(this, <?php echo $row['id']; ?>)"><i class="fa fa-comments-o" style="font-size:16px"></i> Comment</button>
255                                 
256                                     <div class="commentSection" style="display: none;" data-postid="<?php echo $row['id']; ?>">
257                                         <div style="display: flex; align-items: center;">
258                                             <input type="hidden" name="cmtid" value="<?php echo $row['id']; ?>">
259                                             <?php 
260                                              $id = $_SESSION['userfolder'];
261                                              $stmt = $GLOBALS["mysqli_con"]->prepare("SELECT * FROM `login` WHERE userfolder = ?");
262                                             $stmt->bind_param("s", $id);  // "s" means the type is string
263                                             $stmt->execute();
264                                             $trestv = $stmt->get_result();
265                                             
266                                             while ($jilan = $trestv->fetch_array()) {
267                                                 $lnk = !empty($jilan['logo']) ? REDIRECT . '/usersimages/' . $jilan['logo'] : "https://globalfamily.in/images/dp.jpg";
268                                             ?>
269                                             
270                                             <img src="<?php echo $lnk; ?>" alt="site" height="54" width="54" class="rounded-circle" name="image">
271                                             <input type="hidden" name="uname" value="<?php echo $jilan['userfolder']; ?>">
272                                             <?php } ?>

Stack Trace

#4
+
 /home3/jilan/public_html/protected/controllers/NgoController.php(50): CController->render("state")
45             );
46         }
47     }
48      
49        public function actionState() {
50         $this->render('state');
51     }
52     
53        public function actionSearch() {
54         $this->render('search');
55     }
#17
+
 /home3/jilan/public_html/index.php(22): CApplication->run()
17     defined('YII_DEBUG') or define('YII_DEBUG', true);
18 // specify how many levels of call stack should be shown in each log message
19     defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', 3);
20 
21     require_once($yii);
22     Yii::createWebApplication($config)->run();
23 }  
2026-03-10 18:15:02 Apache Yii Framework/1.1.10